@echo off

REM To use this batch file, run this file elevated (runas administrator)

Set BaseDir=%~d0%~p0

SET BinDir=%BaseDir%..\bin\Debug
SET TargetDir=%BinDir%

SET AssemblyName=Baula.TextGen.ComAndVbeIntegration.dll
SET BinPath=%BinDir%\%AssemblyName%
SET TargetName=TextGen
REM TextGen.tlb will be created after tweaking the idl-file (refer to DifferentLibraryName.txt)
SET TlbPath=%BinDir%\%TargetName%.tlb
SET OriginalTlbName=%TargetName%_original.tlb

ECHO INFO: Registering %BinPath%
ECHO INFO: and emitting %TlbPath%
%windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe "%BinPath%" /codebase /tlb:"%TlbPath%" /nologo /silent

ECHO INFO: Renaming TypeLib to %OriginalTlbName%
IF EXIST %BinDir%\%OriginalTlbName% DEL %BinDir%\%OriginalTlbName%
REN "%TlbPath%" "%OriginalTlbName%"

pause